//Page Object
var app = getApp();
Page({
  data: {
    showtab: 0, //顶部选项卡索引,
    setTab: true,
    backIndex:0
  },
  /* tab */
  setTab: function (e) {
    let _this = this
    console.log(e)
    const edata = e.currentTarget.dataset;
    this.setData({
      showtab: edata.tabindex,
      flag: true,

    })
  },

  //加载刷新
  loadRefresh:function(){
    var _tath = this;
    getApp().request({
      url: getApp().api.cardshop.my_gift_card,
      data: {},
      success: function (t) {
        _tath.setData({
          all_list: t.data.all_list,
          not_list: t.data.not_list,
          end_list: t.data.end_list,
        });
      },
      complete: function () { }
    });
  },
  onLoad: function (options) {
    let that = this
    if (options.backIndex==0){
      that.setData({
        backIndex: options.backIndex
      })
    }
    
    this.loadRefresh();
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {
  
  },
  onPageScroll: function () {

  },
  //item(index,pagePath,text)
  onTabItemTap: function (item) {

  }
});